<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2016/6/12
  Time: 14:34
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href="/wechat/ucenter/fillMsg.css">
    <jsp:include page="../public/head.jsp" flush="true" />
</head>
<body>
<header >
    <div class="h-cont">
        <div class="h-l"><i class="iconfont icon-person" onclick="history.go(-1)">&#xe625;</i></div>
        <div class="h-r"><span>${title}</span></div>
        <div class="h-t"><a  onclick="save()"><span>保存</span></a></div>
    </div>
</header>
<div class="h-ocupie"></div>
<section>
    <div class="my_address">
        <form id="form" onsubmit="return false">
            <input type="hidden" name="id" value="${userinfo.id}">
            <div class="cont">
                <span>昵称:</span>
                <input type="text" class="txt" name="nickname" placeholder="请输入昵称" id="nickname" value="${userinfo.nickname}">
            </div>
            <div class="cont">
                <span>性别:</span>
                <%--<input type="radio" class="txt" name="" value="男" >--%>
                <%--<input type="radio" class="txt" name="" value="女" >--%>
                <select class="myselect" name="sex" id="sex">
                    <option value="男">男</option>
                    <option value="女">女</option>
                </select>
            </div>
            <div class="cont">
                <span>生日:</span>
                <input type="date" class="mydate" name="birthday" id="birthday" value="${userinfo.birthday}" pattern="选择日期">
            </div>

                <div class="cont">
                    <a href="/beforelogin/modifyPwd.do"><span>修改密码</span></a>
                <%--<input type="text" class="txt" name="" placeholder="请输入地址">--%>
            </div>
        </form>
    </div>
</section>
<script>
    function save() {
        if ($("#nickname").val() == 0){
            tip("","请输入昵称",true);
            return;
        }
        if ($("#birthday").val() == 0){
            tip("","请输入生日",true);
            return;
        }

        console.log($("#form").serialize());
        $.post("/mobile/user?action=update",$("#form").serialize(),function (data) {
            if (!data.success){
                tip("",data.msg,true);
            }else {
                window.location.replace("/ucenter/index.do");
            }
        },"json");
    }

    $("#sex").val('${userinfo.sex}');
</script>
</body>
</html>
